;var module = angular.module('CtrlsContent');
module.controller('WenkuinitCtrl',['$scope','api_other','$state',function($scope,api_other,$state){
	$scope.banner = "images/img/bg_lead02.jpg";
	$scope.title = localStorage.bls_catname;
	$scope.event = {
		getBanner:function(){
			var obj = {
				cat_id:localStorage.catId,
				type:3
			};
			var promise = api_other.getBanner(obj);
			promise.success(function(data){
				if(data.returnCode == 0){
					$scope.banner = "http://"+data.returnData.wenkuAds;
				}
			})
		},
		goumai:function(){
			var obj = {
				userId:localStorage.bls_userId,
				catId:localStorage.catId,
				page:1
			};
			var pro = api_other.ziliao(obj);
			pro.success(function(data){
				if(data.returnCode == 0){
					 if(data.returnData[0].status==0){
					 	$state.go('wenkugoumailist',{type:1});
					 }else{
					 	alert('您已购买文库，请进入查看');
					 	$state.go('wenkuselect');
					 }
				}
			});
		}
	};
	$scope.event.getBanner();
}]);